package jdbc_practice;

import jdbc.DBUtil;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;

public class Demo1 {
    public static void main(String[] args) {
        try {
            Connection connection = DBUtil.getConnection();
            Statement statement = connection.createStatement();
            String sql = "CREATE TABLE user(\n" +
                    "    id INT PRIMARY KEY AUTO_INCREMENT,\n" +
                    "    username VARCHAR(32),\n" +
                    "    password VARCHAR(32),\n" +
                    "    nickname VARCHAR(32),\n" +
                    "    age INT(3)\n" +
                    ")";
           statement.executeUpdate(sql);
           System.out.println("执行成功");
           connection.close();
        } catch (SQLException e) {
            e.printStackTrace();
        }

    }
}
